package cn.newgrand.netcall.muc;

import org.jivesoftware.spark.SparkManager;

public class MUCUtil {
	public static String chinaGroupServiceName = "chinagroup."+ SparkManager.getConnection().getServiceName();
	
	public static String getChinaGroupServiceName(){
		return chinaGroupServiceName;
	}
	/**
	 * 读取房间的jid
	 * 如roomid@conference.domain/nickname
	 * 去除/nickname，返回roomJID=roomid@conference.domain
	 * @param str
	 * @return
	 */
	public static String getRoomAddress(String str){
		int idx = str.indexOf('/');
		if(idx==-1)
			return str;
		else
			return str.substring(0,str.lastIndexOf('/'));
		
	}
	
	public static boolean isChinaGroupChat(String roomJID){
		return roomJID.endsWith(chinaGroupServiceName);
	}
	
}
